<?php
namespace jy_weishop;
defined('BY_JYA') or exit('error');
/*
	核销
*/
class verify extends \plugin{
	//配送核销
	public function self_verify($verify_code,$clerk_id){
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$order_verify=$this->pdo_get('order_self',array('number'=>$verify_code));
		if(!$order_verify){
			exi('核销码不存在！','error','jy_weishop/verify.selfindex/');
		}
		if($order_verify['status'] ){
			exi('核销码已被使用或已过期！','error','jy_weishop/verify.selfindex/');
		}
		//按消费码核销
		$update=array(
				'status'=>1,
				'clerk_id'=>$clerk_id,
				'verifytime'=>TIMESTAMP,
		);
		$this->pdo_update('order_self',$update,array('id'=>$order_verify['id']));
		$check=$this->pdo_getcolumn('order_self',array('orderid'=>$order_verify['orderid'],'status'=>0),'id');
		if(!$check){
			$this->model('order')->order_receive($order_verify['orderid']);
		}
		return true;
	}
	
}